import Vue from 'vue'
import App from './App.vue'
import router from '@/router/index.js'
import Vant from 'vant';
import 'vant/lib/index.css';
import './style/index.less'

import axios from '@/utils/request'

Vue.use(Vant);

import { NavBar, Swipe, Card, DropdownMenu, DropdownItem, TreeSelect } from 'vant';

Vue.use(Swipe);
Vue.use(NavBar);
Vue.use(Card);
Vue.use(DropdownMenu);
Vue.use(DropdownItem);
Vue.use(TreeSelect);

Vue.config.productionTip = false

// 图片路径拼接过滤器
Vue.filter('joinPath', (val) => {
  if (!val) { return val }
  // 如果路径已经有域名
  if (val.indexOf('http') != -1) {
    return val
  } else {
    return axios.defaults.baseURL + '/img/' + val
  }
})

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')